package com.zhf.client;

import com.zhf.model.User;
import com.zhf.model.UserMessage;
import com.zhf.model.UserPassword;
import com.zhf.model.UserUpdVo;

/**
 * 学员管理UI界面
 */
public class ClientTrainUI {

    /**
     * 添加学员
     */
    public UserMessage addTrainee(){
        System.out.println("请输入要添加学员的账号：");
        String accountNo = ClientScanner.getScanner().next();
        System.out.println("请输入要添加学员的密码：");
        String password = ClientScanner.getScanner().next();
        User user = new User(accountNo, password);
        UserMessage userMessage = new UserMessage("userCheck", user);
        return userMessage;
    }

    /**
     * 修改学员
     * @return
     */
    public UserUpdVo updateTrainee(){
        System.out.println("请输入要修改的学员的账号：");
        String originAccountNo = ClientScanner.getScanner().next();
        System.out.println("请输入修改后的学员账号：");
        String newAccountNo = ClientScanner.getScanner().next();
        System.out.println("请输入修改后的学员密码：");
        String newPassword = ClientScanner.getScanner().next();
        UserMessage userMessage = new UserMessage("userCheck", new User(newAccountNo, newPassword));
        UserUpdVo userUpdVo = new UserUpdVo(userMessage, originAccountNo);
        return userUpdVo;
    }

    /**
     * 删除学员
     * @return
     */
    public User deleTrainee(){
        System.out.println("请输入要删除的学员的账号：");
        String accountNo = ClientScanner.getScanner().next();
        User user = new User(accountNo, null);
        return user;
    }

    /**
     * 查找学员
     * @return
     */
    public User selectTrainee(){
        System.out.println("请输入查找的学员的账号：");
        String accountNo = ClientScanner.getScanner().next();
        User user = new User(accountNo, null);
        return user;
    }

    /**
     * 修改密码
     * @return
     */
    public UserPassword updatePassword(){
        System.out.println("请输入你的原始密码：");
        String oldPassword = ClientScanner.getScanner().next();
        System.out.println("请输入你的新密码：");
        String newPassword = ClientScanner.getScanner().next();
        return new UserPassword(null, oldPassword, newPassword);
    }
}
